package com.lzh.lzhframework.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 友链状态枚举
 *
 * @author luzhiheng
 * @date 2023-12-01
 */

public enum FriendLinkStatusEnum {

    DE_LIST(0, "下架"),
    LIST(1, "上架"),
    APPLY(2, "申请"),
    ;

    public final Integer code;
    public final String value;

    FriendLinkStatusEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public static String codeToValue(Integer code) {
        if (null == code) {
            return null;
        }
        for (FriendLinkStatusEnum ruleColorEnum : FriendLinkStatusEnum.values()) {
            if (ruleColorEnum.code.equals(code)) {
                return ruleColorEnum.getValue();
            }
        }
        return null;
    }

    public static Integer valueToCode(String value) {
        if (StringUtils.isEmpty(value)) {
            return null;
        }
        for (FriendLinkStatusEnum feedbackStatusEnum : FriendLinkStatusEnum.values()) {
            if (feedbackStatusEnum.value.equals(value)) {
                return feedbackStatusEnum.code;
            }
        }
        return null;
    }

    public int getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }
}
